#include<stdio.h>
#include<stdlib.h>
#include "mxml.h"
int main (int argc, char **argv)
{
    //创建一个新的XML文件
    mxml_node_t *xml = mxmlNewXML("1.0");
    //添加一个根节点
    mxml_node_t *books = mxmlNewElement(xml,"books");
    //在books 节点下创建一个book节点
    mxml_node_t  * book = mxmlNewElement(books,"book");
    //设置属性
    mxmlElementSetAttr(book,"id","001");
    mxml_node_t *author = mxmlNewElement(book,"author");
    mxmlNewText(author,0,"邢鹏");

    FILE *fp = fopen("book.xml","wb");
    mxmlSaveFile(xml,fp,MXML_NO_CALLBACK);
    fclose(fp);
    mxmlDelete(xml);
    return 0;
}